/**
 * createTime: 2018/3/15 15:19
 * author: zhibin.zhao
 * description:
 */

'use strict';
const repos = require('./data');
const fs = require('fs');

module.exports = {
    store(){
        fs.writeFileSync(__dirname+'/data.json', JSON.stringify(repos));
    },
    get(index){
      return repos[index];
    },
    list(){
        return repos;
    },
    add(name){
        repos.push(name);
        this.store();
    },
    del(index){
        repos.splice(index, 1, newName);
        this.store();
    },
    update(index, newName){
        repos.splice(index, 1, newName);
        this.store();
    }
}